<template>
  <div class="page">
    <div class="main">
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>
             <navigation />
          </span>
        </div>
        <div class="list" id="taskScore">
              <el-table
                :header-cell-style="{background:'#f5f5f5'}"
                :data="tableData"
                style="width: 100%"
                height="730"
                border
                row-key="id"
                :tree-props="{children: 'subtasks', hasChildren: 'hasChildren'}"
              >
                <el-table-column prop="targetName" label="目标任务名称">
                </el-table-column>
                <el-table-column label="领导小组">
                  <template>{{ departmentName }}</template>
                </el-table-column>
                <el-table-column label="第一季度">
                  <template slot-scope="scope">{{
                    embellishDate(scope.row.oneQuarterNumber)
                  }}</template>
                </el-table-column>
                <el-table-column label="第二季度">
                  <template slot-scope="scope">{{
                    embellishDate(scope.row.twoQuarterNumber)
                  }}</template>
                </el-table-column>
                <el-table-column label="第三季度">
                  <template slot-scope="scope">{{
                    embellishDate(scope.row.threeQuarterNumber)
                  }}</template>
                </el-table-column>
                <el-table-column label="全年">
                  <template slot-scope="scope">{{
                    embellishDate(scope.row.allNumber)
                  }}</template>
                </el-table-column>
                <el-table-column fixed="right" width="300" label="操作">
                  <template slot-scope="scope">
                    <el-button
                      type="primary"
                      size="mini"
                      @click="addTask('0', scope.row)"
                      v-if="!scope.row.subtasks || scope.row.subtasks.length==0"
                      >分解</el-button
                    >
                    <el-button
                      type="primary"
                      size="mini"
                      @click="setCheck(scope.row)"
                      v-if="!scope.row.subtasks || scope.row.subtasks.length==0"
                      >查看</el-button
                    >
                    <el-button
                      type="success"
                      size="mini"
                      @click="addTask('1', scope.row)"
                      >修改</el-button
                    >
                  </template>
                </el-table-column>
              </el-table>
        </div>
      </el-card>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      tableData: [],
    };
  },
  mounted() {
    this.taskId = this.$route.query.taskId;
    this.departmentName = this.$route.query.departmentName;
    this.getListByPage();
  },
  // 计算属性
  computed: {
  },
  methods: {
    embellishDate(text) {
      let _text = 0;
      if (text) {
        _text = text;
      }
      return _text;
    },
    getBack() {
      this.$router.go(-1);
    },
    dataTotal(val) {
      this.pageNum = val;
    },
    // 编写备注
    dataRemark() {
      this.dialogVisible = true;
    },
    // 获取数据列表
    getListByPage() {
      let _obj = {
        taskId: this.taskId
      };
      this.$axios
        .post(`/distribution/getList`, _obj)
        .then(res => {
          if (res.code == 200) {
            this.tableData = res.data;
          }
        })
        .catch(err => {
          console.log(err);
        });
    }
  }
};
</script>
<style scoped>
.page {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.main {
  width: 100%;
  height: 100%;
  /* background: #fff; */
}
.subnav {
  float: left;
  width: 100%;
  height: 60px;
  line-height: 60px;
}
.searchLeft {
  float: left;
  width: 400px;
  /* height: 40px; */
}
.searchLeft > button {
  width: 100px;
  height: 40px;
  background: #409eff;
  color: #fff;
  border: 0px;
  font-size: 16px;
  text-align: center;
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
  position: relative;
  left: -8px;
  top: 1px;
}
.searchRight {
  float: left;
  width: auto;
}
.searchRight > span {
  display: inline-block;
  width: 80px;
  height: auto;
  font-size: 14px;
  text-align: center;
  margin-left: 20px;
}
.el-scrollbar__wrap {
  overflow-x: hidden;
}
.page-component__scroll {
  height: 100%;
}
.list {
  width: 100%;
  height: 100%;
  /* padding-top: 60px; */
  padding-bottom: 60px;
}
.laypage {
  width: 100%;
  height: 60px;
  position: relative;
  top: -60px;
  text-align: right;
}
</style>
<style>
#taskScore .el-scrollbar__wrap {
  overflow: visible;
  overflow-y: scroll;
}
.place {
  float: right;
  position: relative;
  top: -6px;
}
</style>
